package Unidad2;
import java.awt.Color;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JFrame;
import javax.swing.JPanel;
import Utilerias.Apariencia;
import componentes.CompBoton;

/**
 * @author Reynald0
 */
public class Ejercicio1 extends JFrame implements ActionListener
{
   private CompBoton amarillo;
   private CompBoton azul;
   private CompBoton verde;
   private JPanel panel;

   public Ejercicio1()
   {
      
      setTitle("Ejercicio1");
      panel = new JPanel(new GridLayout(1,3,30,30));
      add(panel);
      amarillo = new CompBoton(panel,"Amarillo",this);
      azul = new CompBoton(panel,"Azul",this);
      verde = new CompBoton(panel,"Verde",this);
      setVisible(true);
      setBounds(200,200,500,400);
      setDefaultCloseOperation(EXIT_ON_CLOSE);
   }
   
   public void actionPerformed(ActionEvent pE)
   {
      if (pE.getSource().equals(amarillo))
         panel.setBackground(Color.YELLOW);
      else if (pE.getSource().equals(azul))
         panel.setBackground(Color.BLUE);
      else if (pE.getSource().equals(verde))
         panel.setBackground(Color.GREEN);
   }
   
   public static void main(String[] args)
   {
      new Apariencia(Apariencia.SYNTHETICA_BLUE_LIGHT);
      new Ejercicio1();
   }
}
